package com.four.peoplemanage.excontracts.controller;

import com.four.peoplemanage.common.bean.ResponseData;
import com.four.peoplemanage.common.controller.BaseController;
import com.four.peoplemanage.excontracts.entity.Excontracts;
import com.four.peoplemanage.excontracts.service.ExcontractsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/excontracts")
public class ExcontractsController extends BaseController {
    @Autowired
    ExcontractsService excontractsService;
    @PostMapping("/insert")
    public ResponseData<Boolean> insert(Excontracts excontracts){
        System.out.println("打印"+excontracts);
        return returnBoolean(excontractsService.insert(excontracts));

    }
    @GetMapping("/getAll")
    public ResponseData<Object> getAll(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam(value = "name",required = false) String name,
            @RequestParam(value = "post",required = false) String post,
            @RequestParam(value = "type_contract",required = false) String type_contract
    ){
        return returnObject(excontractsService.getPageExcontracts(pageNum, pageSize, name,post,type_contract));
    }
}
